#include "process.h"

const char* lable = "|/-\\";
char buffer[NUM];

void Process_flush(double rate)
{
	int cnt = (int)rate;
	int n = strlen(lable);
	if (rate <= 1.0)
	{
		buffer[0] = Head;
	}
	printf("[%-100s][%.lf%%][%c]\r", buffer, rate, lable[cnt % n]);
	fflush(stdout);
	buffer[(int)rate] = Body;
	if ((int)rate < 100)
	{
		buffer[(int)rate + 1] = Head;
	}
	if (rate >= 100.0)
	{
		printf("\n");
	}
}